package com.tangtang.core;

import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

/**
 * @author Administrator
 */
public class ResourceUtil {
    private static Map<String, ResourceBundle> cache = new HashMap<String, ResourceBundle>();

    /**
     * @param key
     * @return
     */
    public static final String getString(String key) {
        return getString("config", key);
    }

    public static final String getString(String resourceName, String key) {
        ResourceBundle bundle = null;
        if (!cache.containsKey(resourceName)) {
            bundle = java.util.ResourceBundle.getBundle(resourceName);
            cache.put(resourceName, bundle);
        } else {
            bundle = cache.get(resourceName);
        }
        return bundle.getString(key);
    }
}
